clear
clear all
cap log close

log using "log-files/2_Figure_2.smcl", replace smcl

timer on 2

*----------*
* Figure 2 *
*----------*
	* Figure 2a
	*------------
		use "data/outputs/computo_verificadortrepdate_nomissings_oasorder.dta", clear	

		twoway (scatter mshare_so pcs_so, msymbol(p) msize(vsmall) mcolor(gs10)) ///
			(lowess mshare_so pcs_so if pcs_so < .95, mean bw(0.3) ///
				lcolor(midblue) lwidth(thick)) ///
			(lowess mshare_so pcs_so if pcs_so >= .95, mean bw(0.6) ///
				lcolor(midblue) lwidth(thick)), ///
			xline(0.95, lcolor(black)) ///
			yline(0.5, lcolor(black)) ///
			xsize(7) ysize(4.7) ///
			ytitle("Polling-Station-Level MAS Vote Share") ///
			xtitle("Proportion of Preliminary Vote Counted") ///
			graphregion(color(white)) legend(off) ///
			ylabel(0 "0" .2 "20" .4 "40" .6 "60" .8 "80" 1 "100", angle(0)) ///
			xlabel(0 "0" .95 ".95" 1 "1", angle(0))
		graph export "outputs/generated/Figure_2a.png", replace

	* Figure 2b
	*----------
		use "data/outputs/computo_verificadortrepdate_nomissings_oasorder.dta", clear

		twoway (scatter mshare_so pcs_so, msymbol(p) msize(vsmall) mcolor(gs10)) ///
			(lowess mshare_so pcs_so if pcs_so < .95, bw(0.3) ///
				lcolor(midblue) lwidth(thick)) ///
			(lowess mshare_so pcs_so if pcs_so >= .95, bw(0.6) ///
				lcolor(midblue) lwidth(thick)), ///
			xline(0.95, lcolor(black)) ///
			yline(0.5, lcolor(black)) ///
			xsize(7) ysize(4.8) ///
			ytitle("Polling-Station-Level MAS Vote Share") ///
			xtitle("Proportion of Preliminary Vote Counted") ///
			graphregion(color(white)) legend(off) ///
			ylabel(0 "0" .2 "20" .4 "40" .6 "60" .8 "80" 1 "100", angle(0)) ///
			xlabel(0 "0" .95 ".95" 1 "1")
		graph export "outputs/generated/Figure_2b.png", replace

*------------------------------------------------------------------------------*
timer off 2
timer list 2

log close
clear all
